﻿/*
 * 2008 (c) ralfoide at gmail com
 * Project: SharpFlow
 * License: GPL
 */

using System;

namespace Alfray.SharpFlow.Core {

    /// <summary>
    /// Description of a Financial Institution
    /// </summary>
    public class FI : IComparable<FI> {
        private string mName;
        private string mGuid;

        public FI(string name, string guid) {
            this.mName = name;
            this.mGuid = guid;
        }

        public string name {
            get { return mName; }
        }

        public string guid {
            get { return mGuid; }
        }

        public override string ToString() {
            return mName;
        }

        public override bool Equals(object obj) {
            if (obj is FI) {
                FI other = obj as FI;
                return mName == other.mName && mGuid == other.mGuid;
            } else {
                return base.Equals(obj);
            }
        }

        // Should override GetHashCode if Equals is overriden
        public override int GetHashCode() {
            return base.GetHashCode();
        }

        #region IComparable<FI> Members

        /// <summary>
        /// Compares using the name.
        /// </summary>
        int IComparable<FI>.CompareTo(FI other) {
            return mName.CompareTo(other.mName);
        }

        #endregion

        public string ToFullString() {
            return String.Format("FI[{0}, {1}]", mGuid, mName);
        }
    }
}
